<?php


namespace app\common\model\lottery;

use app\common\model\BaseModel;
use app\common\model\User;

class Log extends BaseModel
{
    protected $name = 'lottery_log';

    protected $autoWriteTimestamp = false;

    public function user()
    {
        return $this->hasOne(User::class, 'user_id', 'user_id');
    }

    public function lotteryGoods()
    {
        return $this->hasOne(Goods::class, 'id', 'lottery_goods_id');
    }

    public function getCreateTimeAttr($value)
    {
        return $value ? date('Y-m-d', $value) : '';
    }
}